﻿@{
    ViewBag.Title = "更改手机绑定";
    Layout = "~/Views/Shared/_LayoutFore.cshtml";
}
@section script{
    @*<script src="~/Content/assets/js/jquery-1.10.2.min.js"></script>*@
    <script src="~/Scripts/jquery.passwordStrength.js"></script>
    <script type="text/javascript">

        function PhoneCertificationOnSuccess(data) {
            if (data.Status == 1) {
                $.dialog.tips(data.Message, 1, 'tips.gif', function () {
                    window.location.href = data.Data;
                });
            } else {
                $.dialog.tips(data.Message, 3, 'tips.gif');
                return false;
            }
        }

        ;

        /*------手机验证------*/
        var InterValObj;
        //timer变量，控制时间
        var count = 120;
        //间隔函数，1秒执行
        var curCount;
        //当前剩余秒数
        var code = "";
        //验证码
        var codeLength = 6;
        //验证码长度


        //timer处理函数

        function SetRemainTime() {
            if (curCount == 0) {
                window.clearInterval(InterValObj); //停止计时器
                $("#btnSendCode").removeAttr("disabled"); //启用按钮
                $("#btnSendCode").val("重新发送验证码");
                code = ""; //清除验证码。如果不清除，过时间后，输入收到的验证码依然有效    
            } else {
                curCount--;
                $("#btnSendCode").val("请在" + curCount + "秒内输入验证码");
            }
        }

        $(function () {
            $("form").Validform({
                tiptype: 3
            });
            $("#btnSendCode").click(function () {
                var mobilenumber = $("#Mobilenumber").val();
                if (mobilenumber.trim() != "") {
                    curCount = count;
                    var Phone = $("#Mobilenumber").val();
                    //设置button效果，开始计时
                    $("#btnSendCode").attr("disabled", "true");
                    $("#btnSendCode").val("请在" + curCount + "秒内输入验证码");

                    //向后台发送处理数据
                    $.ajax({
                        url: '/tools/AdminAjax.ashx?action=get_validate_code&phone=' + Phone + '&sign=user_update', //目标地址
                        type: "Get", //用POST方式传输  
                        datatype: "json",
                        error: function (XMLHttpRequest, textStatus, errorThrown) {
                        },
                        success: function (msg) {
                            InterValObj = window.setInterval(SetRemainTime, 1000); //启动计时器，1秒执行一次
                        }
                    });
                } else {
                    $.dialog.tips("请输入手机号码", 2, 'tips.gif');
                }
            });
        });

    </script>
    <style>
        .tab-content dl dt:first-child {
            width: 120px;
            text-align: right;
        }
    </style>
}
<div class="RightContrent">
    <div style="margin-left: 50px; margin-right: 50px;">
        <div class="tab-content">
            <div class="line10"></div>
            <div class="line10"></div>
            <div class="tab_title">@ViewBag.Title</div>
            <div class="tab-content">
                <div style="width: 16px; height: 12px; float: left;">
                    <img src="~/Content/Images/leftarraw.png" />
                </div>
            </div>

            <div class="tab-content_border">

                <div class="u-center">
                    <div class="u-form-wrap">
                        @using (Ajax.BeginForm("PhoneCertification", new AjaxOptions() { OnSuccess = "PhoneCertificationOnSuccess" }))
                        {
                            <div class="tab-content">

                                <dl>
                                    <dt>请输入账户登录密码：</dt>
                                    <dd>
                                        <input type="password" id="txtPwd" name="txtPwd" datatype = "*6-20" nullmsg = "请输入账户登录密码" errormsg = "密码范围在6-20位之间" sucmsg = " " class="input normal" />
                                    </dd>
                                </dl>
                                <dl>
                                    <dt>手机号码：</dt>
                                    <dd>
                                        <input type="text" name="Mobilenumber" id="Mobilenumber" class="input normal" placeholder="手机号码" datatype="m" sucmsg=" " ajaxurl="/tools/AdminAjax.ashx?action=validate_phone" />
                                        <input type="button" id="btnSendCode" value="获取验证码" class="btn" />
                                    </dd>
                                </dl>
                                <dl>
                                    <dt>手机验证码：</dt>
                                    <dd>
                                        <input type="text" id="validateCode" name="validateCode" class="input txt" datatype="*" ajaxurl="/tools/AdminAjax.ashx?action=validate_SESSION_SMS_CODE" />
                                    </dd>
                                </dl>
                                <dl>
                                    <dd style="margin-left: 120px">

                                        <input type="submit" value="确定" id="btnPaySure" name="btnPaySure" class="btn" />
                                        <a href='@Url.Action("Index")' class="btn" style="color:white">返回</a>
                                    </dd>
                                </dl>
                            </div>
               
                        }
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
